package ui.frame;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.text.StrBuilder;
import org.mortbay.util.StringUtil;
import ui.interf.LogNotify;

import javax.swing.*;
import java.awt.*;
import java.util.List;


public class LogFrame extends JFrame implements LogNotify {
    private TextField textField = new TextField();
    private List<String> oldLog;
    public LogFrame(List<String> oldLog)
    {
        this.oldLog = oldLog;
        ini();
        setTitle("HBaseFrame");
        setBounds(400, 400, 1200, 800);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);
    }
    public void ini()
    {
        add(textField);
        String log = StringUtils.join(oldLog, "\n");
        textField.setText(log);
    }


    @Override
    public void logNotify(String info) {
        textField.setText(textField.getText() + "\n" + info);
    }

    @Override
    public void clearNotify() {

    }
}
